package com.itheima.stringBuilderDemo;

import java.util.Scanner;

public class stringBuilderDemo4 {
    public static void main(String[] args) {
        //判断字符串是否是对称字符串
        //使用stringbuilder可以有效简化代码
        //1.字符串的拼接
        //2.字符串的反转

        //1.键盘录入
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String str = sc.next();

        //2.反转字符串
        String result = new StringBuilder().append(str).reverse().toString();

        //3.比较
        if(str.equals(result)){
            System.out.println("是对称字符串");
        }else{
            System.out.println("不是对称字符串");
        }

    }
}
